<?php
include_once(dirname(__FILE__) . "/account/account.php");
include_once(dirname(__FILE__) . "/util.php");

$user_id = GetLoginId($_COOKIE['t']);
if ($user_id && $user_id > 0) {
  $account = GetAccountInfo($user_id);
  $full_nick = $account['nick'];
  $max_len = (strlen($full_nick) == mb_strlen($full_nick, 'utf-8')) ? 9 : 5;
  echo '<a title="' . $full_nick . '" href="/account/my.php">' . TruncateStr($full_nick, $max_len) . '</a>';
} else {
  echo '<a title="登录" target="_blank" href="/account/login.php">登录</a>';
}
?>
